<!--suppress HtmlUnknownTag -->
<root xmlns="http://www.w3.org/1999/xhtml"
      xmlns:py="http://genshi.edgewall.org/"
      xmlns:xi="http://www.w3.org/2001/XInclude">
  <xi:include href="rds.html"/>

  <?python
      import os
      from base64 import b64encode
      from mnemoply.utils import MonthYear, format_currency, format_date, getBarcodeImage, read_binary_file
      from mnemoply.common_knowledge import month_captions
 ?>

  <report>
    <pages>
      <page py:for="tpr in ids">
        <?python
            env = model.environment.Environment
            prefix = env.getValue('payment_type_month')
            barcodes_dir = "barcodes"
            barcode_num = prefix + str(tpr).rjust(6, "0")
            tpr =' '+ barcode_num+'_'
            barcode_file = getBarcodeImage(barcode_num, barcodes_dir)

            barcode_b64 = b64encode(read_binary_file("./" + barcode_file))
        ?>
        <tpr py:content="tpr"></tpr>
        <barcode_num py:content="'barcode_'+str(barcode_num)"></barcode_num>
        <barcode>
          <filename>${barcode_num}.png</filename>
          <data py:content="barcode_b64"></data>
        </barcode>
      </page>
    </pages>
  </report>

</root>
